<?php
/**
 * ThemeConfig.php
 *
 * @category    Madoqua
 * @package     View
 * @subpackage  Helper
 */

/**
 * base class
 */
require_once 'Madoqua/View/Helper/Abstract.php';

/**
 * Madoqua_View_Helper_ThemeConfig
 *
 * @category    Madoqua
 * @package     View
 * @subpackage  Helper
 */
class Madoqua_View_Helper_ThemeConfig extends Madoqua_View_Helper_Abstract
{
    /**
     * get the config for a theme
     *
     * @param string $theme
     * @return Zend_Config_Xml
     */
    public function themeConfig($theme = null) {
        if ($theme === null) {
            $theme = Madoqua_Application::getConfiguration()->theme->active;
        }
        //fetch currently active theme by default
        
        $modelLoader = Zend_Controller_Action_HelperBroker::getStaticHelper('modelLoader');
        $modelLoader->load('Theme_Theme');
        //load the theme model
        
        $config = Theme_Theme::getUserConfig($theme);
        //fetch the config
        if ($config !== false) {
            return $config;
            //I has a config
        }
        return false;
    }
}